# -*- coding: utf-8 -*-

# @Date : 2024/9/24 20:48

"""
1. 有一些数据必须你登录之后才能获取到的
利用cookie去完成模拟登陆
https://user.qzone.qq.com/1836189218

需求: 获取左手空间的页面信息
"""
import requests

url = 'https://user.qzone.qq.com/1836189218'


# 反爬参数不一定只会有一个
head = {
    'user-agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36'

}

cookie = 'pgv_pvid=6221761244; fqm_pvqid=11932252-002d-4d97-aa3e-5092bf99720a; RK=Mi9Z9nECdq; ptcz=698475f8c2d11a6d10d47f079f1927b516dc2434433b13c911d5fd3dbb9aa72a; eas_sid=P1g7h1Y4E3k2Q008W4Z0Z5B900; LW_sid=S1C7f1v5K85761z5h2I8F8L0G0; LW_uid=u1l7G1d5z8Q741O5s2Q8j8t0t1; _clck=ls1zxw|1|fns|0; __Q_w_s__QZN_TodoMsgCnt=1; qq_domain_video_guid_verify=9451c41f5060c138; _qimei_uuid42=18913103406100f362cb56a711b6c225f17064cf77; _qimei_fingerprint=dc9ac778ca4a0d5c5ac6719cf470d572; _qimei_q36=; _qimei_h38=19c59bcf62cb56a711b6c22502000004218913; _qpsvr_localtk=0.34156399737267806; pgv_info=ssid=s2723199860; uin=o1836189218; skey=@Dqnq4J6CR; p_uin=o1836189218; pt4_token=sXrm3H3XzNUK8J5M7UJxgAMShO84tT7eACt9Hy01kmU_; p_skey=ntC7bAcrB*Rp2XMg5n-hv*ieyQJ3hkICzOrWTLcUUKM_; Loading=Yes; qzmusicplayer=qzone_player_1836189218_1727181014589; qqmusic_uin=1836189218; qqmusic_key=@Dqnq4J6CR; qqmusic_fromtag=6'

cookies = {cookiea.split('=')[0]:cookiea.split('=')[1] for cookiea in cookie.split('; ')}
# 发请求， 获取响应
"""
如果单独去传递cookie参数， cookie值数据类型得是一个字典
"""
res = requests.get(url, headers=head, cookies=cookies)

# 打印响应内容
print(res.text)
